package school.xauat.offershow.serice.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import school.xauat.offershow.mapper.CommentMapper;
import school.xauat.offershow.pojo.Comment;
import school.xauat.offershow.serice.CommentService;

import java.util.List;

/**
 * @author ：zsy
 * @date ：Created 2021/12/16 0:54
 * @description：
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    CommentMapper commentMapper;

    @Override
    public int insert(Comment comment) {
        comment.setSortId(commentMapper.selectByEntryId(comment.getEntryId()).size() + 1);
        return commentMapper.insertComment(comment);
    }
}
